package dao.impl;

import dao.IUserDao;
import model.User;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;
@Repository
public class UserDao implements IUserDao {
    @Autowired
    private SqlSession sqlSession;
    @Override
    public List<User> login(User user) {
        return sqlSession.selectList("dao.IUserDao.login", user);
    }

    @Override
    public int register(User user) {
        return  sqlSession.insert("dao.IUserDao.register", user);
    }

    @Override
    public int updateMoney(User user) {
        return  sqlSession.update("dao.IUserDao.updateMoney", user);
    }

    @Override
    public int changePass(User user) {
        return  sqlSession.update("dao.IUserDao.changePass", user);
    }
}
